
	/************************************************************************************************

		@API
		Constructor: Interface

		Methods:
			i		Interface				(iid, data)
			b		isImplementedBy	(obj)
			ls	methods					()

	************************************************************************************************/

	//-------------------------------------------------------------------------------
	jsl.Interface = function(iid, data) {
		try {
			var cx, ids, l, a, t, id, dt, mp, ms

			//!
			if(arguments.length !== 2) throw jsl.ParamError()//!

			if(this instanceof arguments.callee) {

				//!
				jsl.validate(iid	, "qid"	, "iid")
				jsl.validate(data	, "a"		, "data")
				if(jsl.Interface.__dt[iid])	throw jsl.ParamError("AlreadyDefined:iid")//!

				//-------------------------------------------------------------------------------
				cx = jsl.__go
				if(iid.indexOf(".") !== -1) {

					ids	= iid.split(".")
					l		= ids.length - 1

					for(a = 0; a < l; a++) {
						id = ids[a]//!
						if(!id) throw jsl.ParamError("BadValue:cid")//!

						cx 	= cx[id]//!
						t 	= typeof cx
						if(t !== "object" && t !== "function")	throw jsl.ParamError("BadValue:cid")
						if(!cx) 																throw jsl.ParamError("BadValue:cid")//!
					}
				}

				mp = {}
				ms = []
				for(a = 0, l = data.length; a < l; a++) {

					id = data[a]

					if(!mp[id]) {//!
						jsl.validate(data[a], "s+", "data[" + a + "]")//!
						ms.push(id)
						mp[id] = true
					}
				}

				ms.sort()
				this.__dt					= ms
				this.__name 			= iid + ""
				this.constructor	= this

				return jsl.Interface.__dt[iid] = cx[iid.slice(iid.lastIndexOf(".") + 1)] = this
			}
			else
				return new arguments.callee(iid, data)
		}
		catch(e) {
			jsl.throwError(e, jsl, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.Interface.prototype 			= jsl.Object()
	jsl.Interface.prototype.__sid = "jsl.Interface"
	//-------------------------------------------------------------------------------
	jsl.Interface.__name	= "jsl.Interface"
	jsl.Interface.__dt		= []
	//-------------------------------------------------------------------------------
	jsl.Interface.prototype.isImplementedBy = function(obj) {
		try {
			var a, l, dt, b, id

			//!
			if(arguments.length !== 1)	throw jsl.ParamError()
			jsl.validate(obj, "o", "obj")//!

			b		= true
			dt	= this.__dt

			for(a = 0, l = dt.length; a < l; a++) {

				id = dt[a]
				if(!obj[id] || typeof obj[id] !== "function") {
					b = false
					break
				}
			}

			return b
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//-------------------------------------------------------------------------------
	jsl.Interface.prototype.methods = function() {
		try {//!
			if(arguments.length)	throw jsl.ParamError()//!
			return this.__dt.slice()
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}

